stations = {}
local is_uninv = minetest.global_exists("unified_inventory") or false

function stations.dual_register_recipe(craft_type, def)
   if is_uninv then
      local input_list = {}
      for item, count in pairs(def.input) do
         table.insert(input_list, item..' '..count)
      end
      local output_name
      if def.output then
         def.output = ItemStack(def.output)
         output_name = def.output:get_name()
      else
         output_name = "none" -- special value for recipes with no output.
      end
      unified_inventory.register_craft({
         type = craft_type,
         items = input_list,
         output = output_name
      })
   end
   simplecrafting_lib.register(craft_type, def)
end

dofile(minetest.get_modpath('stations')..'/craftitems.lua')
dofile(minetest.get_modpath('stations')..'/recipes_anvil.lua')
dofile(minetest.get_modpath('stations')..'/recipes_crystal_w.lua')
dofile(minetest.get_modpath('stations')..'/recipes_mortar.lua')
dofile(minetest.get_modpath('stations')..'/recipes_glazier.lua')
dofile(minetest.get_modpath('stations')..'/recipes_sewing.lua')
dofile(minetest.get_modpath('stations')..'/recipes_spinning_wheel.lua')
dofile(minetest.get_modpath('stations')..'/recipes_woodworking.lua')
dofile(minetest.get_modpath('stations')..'/recipes.lua')
dofile(minetest.get_modpath('stations')..'/scrolls.lua')
dofile(minetest.get_modpath('stations')..'/station_anvil.lua')
dofile(minetest.get_modpath('stations')..'/station_crystals.lua')
dofile(minetest.get_modpath('stations')..'/station_dying.lua')
dofile(minetest.get_modpath('stations')..'/station_fuel_pucks.lua')
dofile(minetest.get_modpath('stations')..'/station_mortar.lua')
dofile(minetest.get_modpath('stations')..'/station_printing.lua')
dofile(minetest.get_modpath('stations')..'/station_glazier.lua')
dofile(minetest.get_modpath('stations')..'/station_spinning_wheel.lua')
dofile(minetest.get_modpath('stations')..'/station_sewing.lua')
dofile(minetest.get_modpath('stations')..'/station_stain.lua')
dofile(minetest.get_modpath('stations')..'/station_weaving_loom.lua')
dofile(minetest.get_modpath('stations')..'/station_woodworking.lua')
